<?php

namespace app\admin\model;

use Jackchow\Rbac\RbacPermission;

class Permission extends RbacPermission
{
    protected $autoWriteTimestamp = 'datetime';
    // 定义时间戳字段名
    protected $createTime = 'created_at';
    protected $updateTime = 'updated_at';

    public function roles()
    {
        return $this->belongsToMany(
            Role::class,
            config('database.prefix') . config('rbac.permission_role_table'),
            config('rbac.role_foreign_key'),
            config('rbac.permission_foreign_key')
        );
    }
}
